import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart

email_host = 'smtp.163.com'
fromAdd = '15030274136@163.com'
email_pwd = '625216'

toAdd = 'cuixuetao@xiangshang360.com,17610769836@163.com'
toCc = 'lipengfei@xiangshang360.com'
content = '带附件的邮件'
title = 'theme'

msg = MIMEMultipart()
file = 'a.txt'
att = MIMEText(open(file, encoding='utf-8').read())

att['Content-Type'] = 'application/octet-stream'
att['Content-Disposition'] = 'attachment; filename="%s"' %file
msg.attach(att)
msg.attach(MIMEText(content))

msg['Subject'] = title
msg['From'] = fromAdd
msg['To'] = toAdd
msg['Cc'] = toCc

smtp = smtplib.SMTP(email_host, port=25)
smtp.login(fromAdd,email_pwd)
smtp.sendmail(fromAdd, toAdd.split(',')+toCc.split(','), msg.as_string())
smtp.quit()
print('发送成功喽--------')